using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class dischargedxMap : EntityTypeConfiguration<dischargedx>
    {
        public dischargedxMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.Admision_id)
                .HasMaxLength(10);

            this.Property(t => t.Type)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("dischargedx");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.Diagnosis_id).HasColumnName("Diagnosis_id");
            this.Property(t => t.Admision_id).HasColumnName("Admision_id");
            this.Property(t => t.Type).HasColumnName("Type");

            // Relationships
            this.HasOptional(t => t.admision)
                .WithMany(t => t.dischargedxes)
                .HasForeignKey(d => d.Admision_id);
            this.HasOptional(t => t.DIAGNOSIS)
                .WithMany(t => t.dischargedxes)
                .HasForeignKey(d => d.Diagnosis_id);

        }
    }
}
